package org.wdcode.core.lucene.field;

import org.apache.lucene.document.Field;
import org.apache.lucene.document.Fieldable;
import org.apache.lucene.document.Field.Index;
import org.apache.lucene.document.Field.Store;

/**
 * 包装Lucene字段接口实现
 * @author WD
 * @since JDK6
 * @version 1.0 2010-07-14
 */
final class LuceneFieldImpl implements LuceneField {
	// 名称
	private String	name;
	// 值
	private String	value;
	// Store
	private Store	store;
	// Index
	private Index	index;

	/**
	 * 构造参数
	 * @param name 名称
	 * @param value 值
	 * @param store Store
	 * @param index Index
	 */
	public LuceneFieldImpl(String name, String value, Store store, Index index) {
		this.name = name;
		this.value = value;
		this.store = store;
		this.index = index;
	}

	/**
	 * 获得名称
	 * @return 名称
	 */
	public final String getName() {
		return name;
	}

	/**
	 * 设置名称
	 * @param name 名称
	 */
	public final void setName(String name) {
		this.name = name;
	}

	/**
	 * 获得值
	 * @return 值
	 */
	public final String getValue() {
		return value;
	}

	/**
	 * 设置值
	 * @param value 值
	 */
	public final void setValue(String value) {
		this.value = value;
	}

	/**
	 * 获得Store
	 * @return Store
	 */
	public final Store getStore() {
		return store;
	}

	/**
	 * 设置 Store
	 * @param store Store
	 */
	public final void setStore(Store store) {
		this.store = store;
	}

	/**
	 * 获得Index
	 * @return Index
	 */
	public final Index getIndex() {
		return index;
	}

	/**
	 * 设置Index
	 * @param index Index
	 */
	public final void setIndex(Index index) {
		this.index = index;
	}

	/**
	 * 获得 Lucene Fieldable
	 * @return Fieldable
	 */
	public final Fieldable getField() {
		return new Field(name, value, store, index);
	}
}
